package sv.gob.mh.dgii.model;

// Generated Dec 12, 2007 3:08:52 PM by Hibernate Tools 3.2.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * TbTipoContrib generated by hbm2java
 */
@Entity
@Table(name = "TB_TIPO_CONTRIB", schema = "CATALOGOS")
public class TbTipoContrib implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private TbTipoContribId id;
	private TbClaseContrib tbClaseContrib;
	private String cusuario;
	private Date fhingreso;
	private Integer bstatus;
	private String dtipo;
	private Integer bdesplegable;
	private Integer brecibeDonacion;
	private Set<RcRuc> rcRucs = new HashSet<RcRuc>(0);

	public TbTipoContrib() {
	}

	public TbTipoContrib(TbTipoContribId id, TbClaseContrib tbClaseContrib,
			String cusuario, Integer bstatus, String dtipo,
			Integer bdesplegable, Integer brecibeDonacion) {
		this.id = id;
		this.tbClaseContrib = tbClaseContrib;
		this.cusuario = cusuario;
		this.bstatus = bstatus;
		this.dtipo = dtipo;
		this.bdesplegable = bdesplegable;
		this.brecibeDonacion = brecibeDonacion;
	}

	public TbTipoContrib(TbTipoContribId id, TbClaseContrib tbClaseContrib,
			String cusuario, Date fhingreso, Integer bstatus, String dtipo,
			Integer bdesplegable, Integer brecibeDonacion, Set<RcRuc> rcRucs) {
		this.id = id;
		this.tbClaseContrib = tbClaseContrib;
		this.cusuario = cusuario;
		this.fhingreso = fhingreso;
		this.bstatus = bstatus;
		this.dtipo = dtipo;
		this.bdesplegable = bdesplegable;
		this.brecibeDonacion = brecibeDonacion;
		this.rcRucs = rcRucs;
	}

	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "cclase", column = @Column(name = "C_CLASE", nullable = false, length = 1)),
			@AttributeOverride(name = "ctipo", column = @Column(name = "C_TIPO", nullable = false, length = 4)) })
	public TbTipoContribId getId() {
		return this.id;
	}

	public void setId(TbTipoContribId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "C_CLASE", nullable = false, insertable = false, updatable = false)
	public TbClaseContrib getTbClaseContrib() {
		return this.tbClaseContrib;
	}

	public void setTbClaseContrib(TbClaseContrib tbClaseContrib) {
		this.tbClaseContrib = tbClaseContrib;
	}

	@Column(name = "C_USUARIO", nullable = false, length = 30)
	public String getCusuario() {
		return this.cusuario;
	}

	public void setCusuario(String cusuario) {
		this.cusuario = cusuario;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "FH_INGRESO", length = 7)
	public Date getFhingreso() {
		return this.fhingreso;
	}

	public void setFhingreso(Date fhingreso) {
		this.fhingreso = fhingreso;
	}

	@Column(name = "B_STATUS", nullable = false, precision = 1, scale = 0)
	public Integer getBstatus() {
		return this.bstatus;
	}

	public void setBstatus(Integer bstatus) {
		this.bstatus = bstatus;
	}

	@Column(name = "D_TIPO", nullable = false, length = 50)
	public String getDtipo() {
		return this.dtipo;
	}

	public void setDtipo(String dtipo) {
		this.dtipo = dtipo;
	}

	@Column(name = "B_DESPLEGABLE", nullable = false, precision = 1, scale = 0)
	public Integer getBdesplegable() {
		return this.bdesplegable;
	}

	public void setBdesplegable(Integer bdesplegable) {
		this.bdesplegable = bdesplegable;
	}

	@Column(name = "B_RECIBE_DONACION", nullable = false, precision = 1, scale = 0)
	public Integer getBrecibeDonacion() {
		return this.brecibeDonacion;
	}

	public void setBrecibeDonacion(Integer brecibeDonacion) {
		this.brecibeDonacion = brecibeDonacion;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbTipoContrib")
	public Set<RcRuc> getRcRucs() {
		return this.rcRucs;
	}

	public void setRcRucs(Set<RcRuc> rcRucs) {
		this.rcRucs = rcRucs;
	}

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 67 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final TbTipoContrib other = (TbTipoContrib) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }
        
        
        
        
}
